// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: AdminSetAdminInfoAction.java

package com.market.web.action;

import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

import com.market.web.XMLLoader;
import com.market.web.utils.EncryptData;

// Referenced classes of package com.market.web.action:
// BaseAction

public class AdminSetAdminInfoAction extends BaseAction2
{

    public AdminSetAdminInfoAction()
    {
    }
    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getPass()
    {
        return pass;
    }

    public void setPass(String pass)
    {
        this.pass = pass;
    }

    public String getRepass()
    {
        return repass;
    }

    public void setRepass(String repass)
    {
        this.repass = repass;
    }

    private String name;

    private String pass;

    private String repass;

    public String execute() throws Exception
    {
        //AdminInfoForm aif = (AdminInfoForm)form;
        ActionMessages error = new ActionMessages();
        boolean isError = false;
        if (getName() == null || getName().equals(""))
        {
            isError = true;
            error.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage(
                    "\u7528\u6237\u540D\u4E0D\u80FD\u4E3A\u7A7A!", false));
        }
        if (getPass() == null || !getPass().equals(getRepass()))
        {
            isError = true;
            error.add(
                            "org.apache.struts.action.GLOBAL_MESSAGE",
                            new ActionMessage(
                                    "\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A\u4E14\u786E\u8BA4\u5BC6\u7801\u5FC5\u987B\u548C\u5BC6\u7801\u76F8\u540C!",
                                    false));
        }
        if (getPass().length() < 8)
        {
            isError = true;
            error.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage(
                    "\u5BC6\u7801\u957F\u5EA6\u8BF7\u4E0D\u8981\u5C0F\u4E8E8\u4F4D!", false));
        }
        if (isError)
        {
            //saveErrors(request, error);
            return INPUT;//mapping.getInputForward();
        }
        else
        {
            XMLLoader.setAdminName(EncryptData.encrypt(getName()));
            XMLLoader.setAdminPass(EncryptData.encrypt(getPass()));
            ActionMessages message = new ActionMessages();
            message.add("org.apache.struts.action.GLOBAL_MESSAGE", new ActionMessage(
                    "\u7BA1\u7406\u5458\u5BC6\u7801\u8BBE\u7F6E\u6210\u529F!", false));
            //saveMessages(request, message);
            return SUCCESS;//mapping.findForward("success");
        }
    }
}
